ref(samples): [Queue Instrumentation 19] Drop Kafka auto-config exclude from Spring Boot samples#5314
Draft
adinauer wants to merge 1 commit intoref/queue-instrumentation-kafka-sample-packagefrom
Conversation
…de from Spring Boot samples
Remove `spring.autoconfigure.exclude=KafkaAutoConfiguration` from the
default `application.properties` and the matching empty override from
`application-kafka.properties` in the three Spring Boot Jakarta samples.
`spring.autoconfigure.exclude` is a single list property, so overriding
it in a profile replaces the whole list rather than merging. Adding a
sibling `rabbitmq` profile with the same pattern would not compose —
activating one profile would unsilence the other's auto-config.
The `@Profile("kafka")` annotations already on `KafkaConsumer` and
`KafkaController` gate the actual listener container and endpoint, so
no broker connection is attempted when the profile is inactive.
`KafkaAutoConfiguration` still runs and creates an unused
`KafkaTemplate` bean in that case, which is harmless.
Sentry's own Kafka auto-config remains gated on
`sentry.enable-queue-tracing=true`, which is only set in
`application-kafka.properties`, so Sentry instrumentation behavior is
unchanged.
This was referenced Apr 21, 2026
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. This PR will not appear in the changelog. 🤖 This preview updates automatically when you update the PR. |
This was referenced Apr 21, 2026
📲 Install BuildsAndroid
|
This was referenced Apr 21, 2026
Draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Stack (Queue Instrumentation)
📜 Description
Remove
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.kafka.KafkaAutoConfigurationfrom the defaultapplication.propertiesand the corresponding empty override fromapplication-kafka.propertiesin all three Spring Boot Jakarta samples (sentry-samples-spring-boot-jakarta,sentry-samples-spring-boot-jakarta-opentelemetry,sentry-samples-spring-boot-jakarta-opentelemetry-noagent).No behavior change in default or
kafka-profile runs.💡 Motivation and Context
spring.autoconfigure.excludeis a single list property — profile-specific files replace it rather than merge. The existing setup worked for one queue profile but does not compose with additional transport profiles we plan to add next (e.g.rabbitmq):Activating the
kafkaprofile would unsilenceRabbitAutoConfigurationand vice versa;--spring.profiles.active=kafka,rabbitmqbecomes order-dependent rather than additive.We can drop the exclude entirely because:
KafkaConsumerandKafkaControlleralready carry@Profile("kafka"), so no@KafkaListenercontainer starts and no broker connection is attempted when the profile is inactive.KafkaAutoConfigurationstill creates an unusedKafkaTemplatebean in non-Kafka runs, which is harmless.SentryKafkaQueueConfigurationinSentryAutoConfiguration) is independently gated on@ConditionalOnProperty(name = "sentry.enable-queue-tracing", havingValue = "true"). That property is only set inapplication-kafka.properties, so Sentry instrumentation behavior is unchanged.This makes the samples compose cleanly with future queue-transport profiles.
💚 How did you test it?
./gradlew :sentry-samples:sentry-samples-spring-boot-jakarta:compileJava :sentry-samples:sentry-samples-spring-boot-jakarta-opentelemetry:compileJava :sentry-samples:sentry-samples-spring-boot-jakarta-opentelemetry-noagent:compileJava— clean build../gradlew spotlessApply apiDump— clean.KafkaQueueSystemTestalready covers thekafkaprofile end-to-end.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Add a
rabbitmqprofile to the Spring Boot Jakarta samples so Kafka and Rabbit can coexist without auto-config exclusion conflicts.#skip-changelog